#ifndef HISTORYMESSAGEDIALOG_H
#define HISTORYMESSAGEDIALOG_H

#include <QDialog>
#include <QVBoxLayout>
#include<QRadioButton>
#include <QLineEdit>
#include<QScrollArea>
#include<QScrollBar>
#include<QDateTimeEdit>
#include <QLabel>
#include"modle/data.h"
using module::Message;
using module::MessageType;


class HistoryMessageShowArea;
class HistoryItem:public QWidget
{
    Q_OBJECT
private:
    HistoryItem(HistoryMessageShowArea*owner,const Message& mes,QWidget*parent=nullptr);
public:
    static HistoryItem *makeMessageItem(HistoryMessageShowArea*owner,const Message& mes);
private:
    static QWidget*makeTextHistotyItem(const Message&mes);
    static QWidget*makeSpecchHistotyItem(const Message&mes);
    static QWidget*makeImageHistotyItem(const Message&mes);
    static QWidget*makeFileHistotyItem(const Message&mes);
    HistoryMessageShowArea*owner;
    QGridLayout*layout;

};







class HistoryMessageShowArea:public QScrollArea
{
    Q_OBJECT
public:
    HistoryMessageShowArea(QWidget*parent=nullptr);
    void addItem(const Message& mes);
private:
    QWidget*cotainer;
    QVBoxLayout*layout;
};





class HistoryMessageDialog : public QDialog
{
    Q_OBJECT
public:
    HistoryMessageDialog(QWidget*parent=nullptr);
private:
    QVBoxLayout *layout;

    QRadioButton*keybut;
    QRadioButton*timebut;
    QLineEdit *searchline;
    QPushButton*searchbtn;


    QLabel *begintimelabel;
    QLabel*endtimelabel;
    QDateTimeEdit*begintime;
    QDateTimeEdit*endtime;


    HistoryMessageShowArea*scrollarea;

};

#endif // HISTORYMESSAGEDIALOG_H
